import { count } from "console"
import Mock from "mockjs"
import type { MockMethod } from 'vite-plugin-mock'
export default [
  // 采收计划数据
  {
    url: '/api/harvest/plans',
    method: 'get',
    response: () => {
      const harvestPlans = Mock.mock({
        'count|6': [
          {
            'id|+1': 1,
            'batch|+1': 2019040001,
            'times|1':[
              '2024.01.01',
              '2024.01.02',
              '2024.01.03',
              '2024.01.04',
              '2024.01.05',
              '2024.01.06',
            ],
            'place|1': [
              "1号地块",
              '2号地块'
            ],
            food: '柑橘(冰糖橙)',
            'weight|1000-9999': 1500,
            'people|1': [
              "王浩",
              "张山"
            ],
            'common|1000-3000': 500,
            commonRequest: "单果50g以上",
            'first|1000-3000': 2100,
            firstRequest: '单果100g以上',
            'second|1000-3000': 1000,
            secondRequest: '单果200g以上',
            'third|1000-2000': 1000,
            thirdtRequest: '单果300g以上'
          }
        ]
      })
      return {
        code: 0,
        msg: 'ok',
        data: { ...harvestPlans }
      }
    }
  },
  // 采收记录数据
  {
    url: '/api/harvest/record',
    method: "get",
    response: () => {
      const harvestRecord = Mock.mock({
        'record|6': [
          {
            'id|+1': 1,
            'batch|+1': 2019040001,
            'times|1':[
              '2024.01.01',
              '2024.01.02',
              '2024.01.03',
              '2024.01.04',
              '2024.01.05',
              '2024.01.06',
            ],
            'place|1': [
              "1号地块",
              '2号地块'
            ],
            food: '柑橘(冰糖橙)',
            'weight|1000-9999': 1500,
            'people|1': [
              "王浩",
              "张山"
            ],
            'common|1000-2000': 500,
            commonRequest: "单果50g以上",
            'first|1000-2999': 2100,
            firstRequest: '单果100g以上',
            'second|1000-2000': 1000,
            secondRequest: '单果200g以上',
            'third|1000-2000': 1000,
            thirdtRequest: '单果300g以上',
          }
        ]
      })
      return {
        code: 0,
        msg: 'ok',
        data: { ...harvestRecord }
      }
    }
  },
  // 获取采收统计数据
  {
    url: '/api/harvest/statistics',
    method: 'get',
    response: () => {
      const harvestStatistic = Mock.mock({
        'count|6': [
          {
            'id|+1': 1,
            'batch|+1': 2019040001,
            'times|1':[
              '2024.01.01',
              '2024.01.02',
              '2024.01.03',
              '2024.01.04',
              '2024.01.05',
              '2024.01.06',
            ],
            'place|1': [
              "1号地块",
              '2号地块'
            ],
            food: '柑橘(冰糖橙)',
            'weight|1000-9999': 1500,
            'people|1': [
              "王浩",
              "张山"
            ],
            'common|1000-9999': 500,
            commonRequest: "单果50g以上",
            'first|1000-9999': 2100,
            firstRequest: '单果100g以上',
            'second|1000-9000': 1000,
            secondRequest: '单果200g以上',
            'third|1000-5000': 1000,
            thirdtRequest: '单果300g以上'
          }
        ]
      })
      return {
        code: 0,
        msg: 'ok',
        data: { ...harvestStatistic }
      }
    }
  },
  // 删除单个数据
  {
    url: '/api/harvest/:batch',
    method: 'delete',
    response: () => {
      return {
        code: 0,
        msg: 'ok',
        // 1表示成功，非1为失败
        data: 1
      }
    }
  },
  // 根据用户batch修改用户信息
  {
    url: '/api/harvest/:id',
    method: 'put',
    response: () => {
      return {
        code: 0,
        msg: 'ok',
        data: 1
      }
    }
  },
  // 新增用户
  {
    url: '/api/harvest/create',
    method: 'post',
    response: () => {
      return {
        code: 0,
        msg: 'ok',
        // 新增返回的数据结果情况
        // 1.返回新增的用户在数据表中的id值
        // 2.返回新增用户的的记录数据，数据它是包含id值的
        data: 10
      }
    }
  },

] as MockMethod[]
